package common.autoreview

import common.qiniu.*
import java.io.File

object ContentSafeDetector {

    private val imageDetectorChain = ImageDetectorChain()

    fun detectImages(files: List<File>): AutoReviewState {
        files.forEach {
            val result = detectImage(it)
            if (result != AutoReviewState.PASS){
                return result
            }
        }
        return AutoReviewState.PASS
    }

    private fun detectImage(image: File): AutoReviewState {
        val key = QiniuUploader.uploadImage(image) ?: return AutoReviewState.REVIEW
        return imageDetectorChain.detectOnChain(key)
    }

}


